package com.erp.controller;

import com.erp.common.core.controller.BaseController;
import com.erp.common.core.page.TableDataInfo;
import com.erp.domain.ErpInboundAudit;
import com.erp.domain.ErpProductVO;
import com.erp.domain.InboundAuditVO;
import com.erp.service.IErpInboundAuditService;
import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author:lxs
 * @CreateTime: 2025-09-06
 * @Description:入库审核多表联查控制层
 */
@RestController
@RequestMapping("/erp/audit/inbound")
@Slf4j
public class ErpInboundAuditController extends BaseController {
    @Autowired
    private IErpInboundAuditService erpInboundAuditService;

    @RequestMapping("list")
    public TableDataInfo list(ErpInboundAudit erpInboundAudit) {
        PageHelper.startPage(1,10);
        List<InboundAuditVO> list = erpInboundAuditService.list(erpInboundAudit);
        return getDataTable(list);
    }

    //查询入库产品数据
    @RequestMapping("product")
    public TableDataInfo product(@RequestParam String inboundNo) {
        List<ErpProductVO> list = erpInboundAuditService.product(inboundNo);
        return getDataTable(list);
    }
    //更新审核状态
    @RequestMapping("update")
    public void updateAudit(@RequestBody ErpInboundAudit erpInboundAudit) {
        erpInboundAuditService.updateAudit(erpInboundAudit);
    }
}
